home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>7.2. Convolution matrix</title>
- <link rel="stylesheet" href="gimp-help-plain.css" type="text/css" />
- <link rel="stylesheet" href="gimp-help-screen.css" type="text/css" />
- <meta name="generator" content="DocBook XSL Stylesheets V1.66.1" />
- <link rel="start" href="index.html" title="GIMP User Manual" />
- <link rel="up" href="ch06s07.html" title="7. Generic filters" />
- <link rel="prev" href="ch06s07.html" title="7. Generic filters" />
- <link rel="next" href="ch06s07s03.html" title="7.3. Dilate" />
- </head>
- <body>
- <div xmlns="" class="navheader">
- <table width="100%" summary="Navigation header">
- <tr>
- <th colspan="3" align="center" id="chaptername">7. Generic filters</th>
- </tr>
- <tr>
- <td width="20%" align="left"><a accesskey="p" href="ch06s07.html">Prev</a> </td>
- <th width="60%" align="center" id="sectionname">7.2. Convolution matrix</th>
- <td width="20%" align="right"> <a accesskey="n" href="ch06s07s03.html">Next</a></td>
- </tr>
- </table>
- <hr />
- </div>
- <div class="sect2" lang="en" xml:lang="en">
- <div class="titlepage">
- <div>
- <div>
- <h3 class="title"><a id="plug-in-convmatrix"></a>7.2. Convolution matrix</h3>
- </div>
- </div>
- </div>
- <a id="id3479895" class="indexterm"></a>
- <div class="mediaobject">
- <img src="../images/filters/filters-generic-convolution.png" />
- </div>
- <div class="simplesect" lang="en" xml:lang="en">
- <div class="titlepage">
- <div>
- <div>
- <h4 class="title"><a id="id3479927"></a>Overview</h4>
- </div>
- </div>
- </div>
- <p>
- This filter is found in
- <span class="guimenuitem">Image>Filters/Generic/<span class="accel">C</span>onvolution Matrix</span>
- </p>
- <p>
- Here is a mathematician's domain. Most of filters are using convolution
- matrix. With the Convolution Matrix filter, if the fancy takes you, you
- can build a custom filter.
- </p>
- <p>
- What is a convolution matrix? It's possible to get a rough idea of it without using
- mathematical tools that only a few ones know. Convolution is the treatment of a matrix
- by another one which is called "kernel".
- </p>
- <p>
- The Convolution Matrix filter uses a first matrix which is the Image to be treated.
- The image is a bi-dimensionnal collection of pixels in rectangular coordinates. The
- used kernel depends on the effect you want.
- </p>
- <p>
- GIMP uses 5x5 or 3x3 matrices. We will consider only 3x3 matrices, they are
- the most used and they are enough for all effects you want. If all border
- values of a kernel are set to
- zero, then system will consider it as a 3x3 matrix.
- </p>
- <p>
- The filter studies successively every pixel of the image. For each of them,
- which we will calll the "initial pixel", it multiplies value of this
- pixel and values of the 8 surrounding
- pixels by the kernel corresponding value. Then it adds the results, and the
- initial pixel is set to takes this final result value.
- </p>
- <p>
- A simple example:
- </p>
- <div class="mediaobject">
- <img src="../images/filters/examples/convolution-example1.png" />
- </div>
- <p>
- On the left is the image matrix: each pixel is marked with its value. The
- initial pixel has a red border. The kernel action area has a green border.
- In the middle is the kernel and, on the right is the convolution result.
- </p>
- <p>
- Here is what happened: the filter read successively, from left to right and
- from top to bottom, all the pixels of the kernel action area. It multiplied
- the value of each of them by the kernel corresponding value and added results:
- (100*0)+(50*1)+(50*0)*(100*0)+(100*0) +(100*0)+(100*0)+(100*0)+(100*0)+(100*0) = 50.
- The initial pixel took the value 50. Previously, when the initial pixel had
- value=50, it took the value 100 of the above pixel (the filter doesn't
- work on the image but on a copy) and so disappeared into the "100" background
- pixels. As a graphical result, the initial pixel moved a pixel downwards.
- </p>
- </div>
- <div class="simplesect" lang="en" xml:lang="en">
- <div class="titlepage">
- <div>
- <div>
- <h4 class="title"><a id="id3480045"></a>Options</h4>
- </div>
- </div>
- </div>
- <div class="variablelist">
- <dl>
- <dt>
- <span class="term">Matrix</span>
- </dt>
- <dd>
- <p>
- This is the 5x5 kernel matrix: you enter wanted values directly into boxes.
- </p>
- <p>
- <span class="guilabel">Divisor</span>: The result of previous calculation will be divided by
- this divisor. You will hardly use 1, that lets result unchanged, and 9 or 25
- according to matrix size, that gives the average of pixel values.
- </p>
- <p>
- <span class="guilabel">Offset</span>: this value is added to the division result. This is
- useful if result may be negative. This offset may be negative.
- </p>
- </dd>
- <dt>
- <span class="term">Border</span>
- </dt>
- <dd>
- <p>
- When the initial pixel is on a border, a part of kernel is out of image. You have to
- decide what filter must do:
- </p>
- <div class="mediaobject">
- <img src="../images/filters/filters-convolution-milord.png" />
- </div>
- <div class="itemizedlist">
- <ul type="disc">
- <li>
- <p>
- <span class="guilabel">Extend</span>: this part of kernel is not taken into acount.
- </p>
- <div class="mediaobject">
- <img src="../images/filters/filters-convolution-extend.png" />
- </div>
- </li>
- <li>
- <p>
- <span class="guilabel">Wrap</span>: this part of kernel will study pixels of the opposite
- border, so pixels disappearing from one side reappear on the other side.
- </p>
- <div class="mediaobject">
- <img src="../images/filters/filters-convolution-wrap.png" />
- </div>
- </li>
- <li>
- <p>
- <span class="guilabel">Crop</span>: Pixels on borders are not modified, but they are cropped.
- </p>
- <div class="mediaobject">
- <img src="../images/filters/filters-convolution-crop.png" />
- </div>
- </li>
- </ul>
- </div>
- </dd>
- <dt>
- <span class="term">Channels</span>
- </dt>
- <dd>
- <p>
- You can select there one or several channels the filter will work with.
- </p>
- </dd>
- <dt>
- <span class="term">Automatic</span>
- </dt>
- <dd>
- <p>
- If this option is checked, The Divisor takes the result value of convolution. If
- this result is equal to zero (it's not possible to divide by zero), then a 128
- offset is applied. If it is negative ( a negative color is not possible), a
- 255 offset is applied (inverts result).
- </p>
- </dd>
- <dt>
- <span class="term">Alpha weighting</span>
- </dt>
- <dd>
- <p>
- If this option is not checked, the filter doesn't take in account transparency and this
- may be cause of some artefacts when blurring.
- </p>
- </dd>
- </dl>
- </div>
- </div>
- <div class="simplesect" lang="en" xml:lang="en">
- <div class="titlepage">
- <div>
- <div>
- <h4 class="title"><a id="id3480234"></a>Examples</h4>
- </div>
- </div>
- </div>
- <p>
- Design of kernels is based on high levels mathematics. You can find ready-made
- kernels on the Web. Here are a few examples:
- </p>
- <div class="variablelist">
- <dl>
- <dt>
- <span class="term">Sharpen</span>
- </dt>
- <dd>
- <div class="mediaobject">
- <img src="../images/filters/examples/convolution-sharpen.png" />
- </div>
- </dd>
- <dt>
- <span class="term">Blur</span>
- </dt>
- <dd>
- <div class="mediaobject">
- <img src="../images/filters/examples/convolution-blur.png" />
- </div>
- </dd>
- <dt>
- <span class="term">Edge enhance</span>
- </dt>
- <dd>
- <div class="mediaobject">
- <img src="../images/filters/examples/convolution-edge.png" />
- </div>
- </dd>
- <dt>
- <span class="term">Edge detect</span>
- </dt>
- <dd>
- <div class="mediaobject">
- <img src="../images/filters/examples/convolution-edge-detect1.png" />
- </div>
- </dd>
- <dt>
- <span class="term">Emboss</span>
- </dt>
- <dd>
- <div class="mediaobject">
- <img src="../images/filters/examples/convolution-emboss.png" />
- </div>
- </dd>
- </dl>
- </div>
- </div>
- </div>
- <div class="navfooter">
- <hr />
- <table width="100%" summary="Navigation footer">
- <tr>
- <td width="40%" align="left"><a accesskey="p" href="ch06s07.html">Prev</a> </td>
- <td width="20%" align="center">
- <a accesskey="u" href="ch06s07.html">Up</a>
- </td>
- <td width="40%" align="right"> <a accesskey="n" href="ch06s07s03.html">Next</a></td>
- </tr>
- <tr>
- <td width="40%" align="left" valign="top">7. Generic filters </td>
- <td width="20%" align="center">
- <a accesskey="h" href="index.html">Home</a>
- </td>
- <td width="40%" align="right" valign="top"> 7.3. Dilate</td>
- </tr>
- </table>
- </div>
- </body>
- </html>
-